
<style type="text/css">
    .stafflist{
        width: 60px;text-align: center;float: left;
    }
    .stafflist img{
        width: 40px;
        height: 40px;
        margin: 10px;
        border-radius:50%;
    }
    .level{
        width: 100px;text-align: center;float: left;padding-top:18px;
        margin-left: 30px;
    }
    .level span:first-child{
        line-height: 2em
    }
</style>
<form id="edit-form" class="form-horizontal col-sm-12" role="form" data-toggle="validator" method="POST" action="">
    {:token()}

    <div class="form-group">


        <div class="col-xs-12 col-sm-6">
            <div class="form-group col-sm-10">
                <label >关联客户:</label>
                <input type="hidden" name="row[customer_id]" data-rule="required" value="{$row.customer_id}" >
                <div class="form-control">
                    <a href="javascript:void(0)" class="select-customer" data-name="row[customer_id]"
                       data-url="qingdong/customer/customer/index?isselect=1"
                    >{if condition="$row.customer"}{$row.customer.name}{else/}【请点击选择】{/if}</a>
                </div>
            </div>
        </div>
        <div class="col-xs-12 col-sm-6">
            <div class="form-group col-sm-10">
                <label for="c-number">报销单号:</label>
                <input id="c-number" data-rule="required" class="form-control "
                       placeholder="请选择报销单号" name="row[number]"  type="text" value="{$row.number}">
            </div>
        </div>
        <div class="col-xs-12 col-sm-6">
            <div class="form-group col-sm-10">
                <label for="c-next_time">消费日期:</label>
                <input id="c-next_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" placeholder="请选择消费日期" name="row[submit_date]" value="{$row.submit_date}" type="text">
            </div>
        </div>
        <div class="col-xs-12 col-sm-6">
            <div class="form-group col-sm-10">
                <label for="c-money">消费金额:</label>
                <input id="c-money" data-rule="required" class="form-control " readonly  placeholder="请选择消费金额" name="row[money]" type="number" value="{$row.money}">
            </div>
        </div>
        <div class="col-xs-12 col-sm-10">
            <div class="form-group col-sm-10">
                <label for="c-remark">备注:</label>
                <textarea id="c-remark" class="form-control" rows="3" name="row[remark]" placeholder="请输入备注">{$row.remark}</textarea>
            </div>
        </div>
        <div class="col-xs-12 col-sm-6">
            <div class="form-group col-sm-10">
                <label for="consume-type">费用类型:</label>
                <select id="consume-type" class="form-control">
                    <option value="0">请选择费用类型</option>
                    {foreach name="consumetype" item="val"}
                    <option value="{$val}" data-key="{$key}">{$val}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="col-xs-12 col-sm-12" id="consume-content">
            {foreach name="$row.detail" item="val" key="key" }
            {eq name="$val.consume_type" value="交通费" }

                <div class="content-list">
                <div class="form-group">
                    <div class="alert alert-warning-light no-margin">{$val.consume_type}<span class="btn btn-sm btn-danger btn-remove" style="float:right;"><i class="fa fa-times"></i></span></div>
                    <input type="hidden" name="row[detail][{$key}][consume_type]"
                           class="form-control" value="交通费"/>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-6 col-sm-2">车牌号:</label>
                    <div class="col-xs-6 col-sm-4">
                        <input type="text" name="row[detail][{$key}][car_number]" placeholder="请输入车牌号"
                               class="form-control" value="{$val.car_number}" />
                    </div>

                    <label class="control-label col-xs-6 col-sm-2">发生时间:</label>
                    <div class="col-xs-6 col-sm-4">
                        <input name="row[detail][{$key}][consume_date]" type="text" placeholder="请选择发生时间"
                               class="form-control datetimepicker" data-date-format="YYYY-MM-DD"
                               value="{$val.consume_date}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-6 col-sm-2">金额:</label>
                    <div class="col-xs-6 col-sm-4">
                        <input type="number" name="row[detail][{$key}][consume_money]" placeholder="请输入金额"
                               class="form-control" data-rule="required" value="{$val.consume_money}"/>
                    </div>


                    <label class="control-label col-xs-6 col-sm-2">起始公里数:</label>
                    <div class="col-xs-6 col-sm-4">
                        <input type="text" name="row[detail][{$key}][start_mileage]" placeholder="请输入起始公里数"
                               class="form-control" value="{$val.start_mileage}"/>
                    </div>

                </div>

                <div class="form-group">
                    <label class="control-label col-xs-6 col-sm-2">结束公里数:</label>
                    <div class="col-xs-6 col-sm-4">
                        <input name="row[detail][{$key}][end_mileage]" type="text" placeholder="请输入结束公里数"
                               class="form-control" value="{$val.end_mileage}">
                    </div>
                    <label class="control-label col-xs-6 col-sm-2">公里数:</label>
                    <div class="col-xs-6 col-sm-4">
                        <input type="number" name="row[detail][{$key}][mileage]" placeholder="请输入公里数"
                               class="form-control" data-rule="required" value="{$val.mileage}"/>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-6 col-sm-2">消费凭证:</label>
                    <div class="col-xs-6 col-sm-10">
                        <div class="input-group">
                            <input id="c-image-{$key}" class="form-control" size="35"
                                   placeholder="请上传消费凭证" name="row[detail][{$key}][file_ids]"
                                   type="text" value="{$val.file_ids}" >
                            <div class="input-group-addon no-border no-padding">
                            <span><button type="button" class="btn btn-danger faupload"
                                          data-url="ajax/upload?type=7" data-input-id="c-image-+num+"
                                          data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
                                          data-multiple="false" data-preview-id="p-image-{$key}">
                                <i class="fa fa-upload"></i>上传</button></span></div>
                            <span class="msg-box n-right"></span></div>
                        <ul class="row list-inline faupload-preview" id="p-image-+num+"></ul>
                    </div>
                </div>
                <div class="form-group"><label class="control-label col-xs-6 col-sm-2">备注:</label>
                    <div class="col-xs-6 col-sm-6">
                        <textarea name="row[detail][{$key}][remark]" class="form-control" rows="2"
                                  placeholder="请填写备注">{$val.remark}</textarea>
                    </div>
                </div>
            </div>
                {else/}
                <div class="content-list">
                <div class="form-group">
                    <div class="alert alert-warning-light no-margin">{$val.consume_type}<span class="btn btn-sm btn-danger btn-remove" style="float:right;"><i class="fa fa-times"></i></span>
                    </div>
                    <input type="hidden" name="row[detail][{$key}][consume_type]"
                           class="form-control consume_type" value="{$val.consume_type}" />
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-6 col-sm-2">发生日期:</label>
                    <div class="col-xs-6 col-sm-4">
                        <input name="row[detail][{$key}][consume_date]" type="text" placeholder="请选择发生日期"
                               class="form-control datetimepicker" value="{$val.consume_date}" data-date-format="YYYY-MM-DD">
                    </div>
                    <label class="control-label col-xs-6 col-sm-2">金额:</label>
                    <div class="col-xs-6 col-sm-4">
                        <input type="number" name="row[detail][{$key}][consume_money]" placeholder="请输入金额"
                               class="form-control" value="{$val.consume_money}" data-rule="required"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-6 col-sm-2">消费凭证:</label>
                    <div class="col-xs-6 col-sm-10">
                        <div class="input-group">
                            <input id="c-image-{$key}" class="form-control" placeholder="请上传消费凭证" size="35"
                                   name="row[detail][{$key}][file_ids]"
                                   type="text" value="{$val.file_ids}" >
                            <div class="input-group-addon no-border no-padding">
                                <span><button type="button" class="btn btn-danger faupload"
                                              data-url="ajax/upload?type=7" data-input-id="c-image-+num+"
                                              data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
                                              data-multiple="false" data-preview-id="p-image-+num+">
                                <i class="fa fa-upload"></i>上传</button></span></div>
                            <span class="msg-box n-right"></span></div>
                        <ul class="row list-inline faupload-preview" id="p-image-{$key}"></ul>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-6 col-sm-2">备注:</label>
                    <div class="col-xs-6 col-sm-6">
                        <textarea name="row[detail][{$key}][remark]" class="form-control"
                                  rows="2" placeholder="请填写备注">{$val.remark}</textarea>
                    </div>
                </div>
            </div>
            {/eq}
            {/foreach}
        </div>

        {if condition="$flow.status == 1"}

        <div class="col-xs-12 col-sm-12">
            <div class="form-group col-sm-10">

                <blockquote style="padding: 2px 10px;">
                    <p>审核信息 <span class="label label-danger">固定审批流</span></p>
                </blockquote>

                {foreach name="$flow.stepList" item="val"}
                <div class="row">
                    <div class="level">
                        <span>第{$val.order_id}级</span><br>
                        {if condition="$val.status == 3"}
                        <span class="label label-info">发起人主管</span>
                        {elseif condition="$val.status == 1"/}
                        <span class="label label-info">{:count($val['stafflist'])}人或签</span>
                        {else/}
                        <span class="label label-info">{:count($val['stafflist'])}人并签</span>
                        {/if}
                    </div>
                    {foreach name="$val.stafflist" item="ves"}
                    <div class="stafflist">
                        <img src="{$ves.img}" class="img-circle">
                        {$ves.name}
                    </div>
                    {/foreach}
                </div>
                <hr>
                {/foreach}


            </div>
        </div>

        {else/}

        <div class="col-xs-12 col-sm-12">
            <div class="form-group col-sm-8">

                <blockquote style="padding: 2px 10px;">
                    <p>审核信息 <span class="label label-danger">发起人自选</span></p>
                </blockquote>
                <div style="margin-left: 20px">
                    <input data-source="qingdongams/jigoucustomer/contract/getstaff"
                           class="form-control selectpage" placeholder="请选择审批人" data-pagination="true" data-page-size="10" name="row[flow_staff_ids]" type="text" data-multiple="true">
                </div>

            </div>
        </div>
        {/if}
    </div>


    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
